<?

if($Db->connect()){

  /**
   * init the details
   */
  require("controllers/initDetails.php");

  echo  "<table border='1' class='dedeq'>\n".
        "<tr>\n".
        "<th> No    </th>\n".
        "<th> Drop  </th>\n".
        "<th> Model </th>\n".
        "<th> Qty </th>\n".
        "<th> SN    </th>\n".
        "</tr>\n";

  /**
   * @see controllers/initDetails.php
   * @var nDetail
   */
  for($iRow = 0; $iRow < $nDetail ; $iRow++){

    $propModel    = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                     Ajax.model(0,
                                                this);").

                    $GJs->jsOnBlur ("GMisc.setWhite2(this);");

    $propSerNum   = $GJs->jsOnFocus("GMisc.setYellow2(this);").

                    $GJs->jsOnBlur ("GMisc.setWhite2(this);
                                     Ajax.setSerNumber(\"headEnt[".$iRow."]\",
                                                       \"lengthEnt[".$iRow."]\",
                                                       \"qtyEnt[".$iRow."]\",
                                                       \"serNumEnt[".$iRow."]\");");

    $_POST["rowId"][$iRow] = date("hi") . $iRow;

    if($_POST["isSNed"][$iRow]){

      $additional = " <td> ".$GHtml->formInput("headEnt[".$iRow."]",
                                               $_POST["headEnt"][$iRow],
                                               $Misc->stdNumStyle(3).
                                               $Misc->stdNoNull())."  </td>

                      <td> ".$GHtml->formInput("lengthEnt[".$iRow."]",
                                               $_POST["lengthEnt"][$iRow],
                                               $Misc->stdNumStyle(3).
                                               $Misc->stdNoNull())."  </td>

                      <td> ".$GHtml->formInput("serNumEnt[".$iRow."]",
                                               $_POST["serNumEnt"][$iRow],
                                               $propSerNum.
                                               $Misc->stdKeyProp("serNumEnt[".($iRow+1)."]"))."  </td> ";
    }else{

      $additional = " <td> ".$GHtml->formHidden("headEnt[".$iRow."]",
                                                "0",
                                                $Misc->stdNumStyle(3).
                                                $Misc->stdNoNull())."  </td>

                      <td> ".$GHtml->formHidden("lengthEnt[".$iRow."]",
                                                "0",
                                                $Misc->stdNumStyle(3).
                                                $Misc->stdNoNull())."  </td>

                      <td> ".$GHtml->formHidden("serNumEnt[".$iRow."]",
                                                $_POST["serNumEnt"][$iRow],
                                                $propSerNum.
                                                $Misc->stdKeyProp("serNumEnt[".($iRow+1)."]"))."  </td> ";
    }

    if($_POST["modelEnt"][$iRow]){

      $lstModel = array($_POST["modelEnt"][$iRow]);
    }else{

      $lstModel = array("");
    }

    //$lstModel = $Misc->retArray($_POST["modelEnt"][$iRow]);

    echo  "<tr>\n".

          "<td> ".($iRow + 1)." </td>\n".

          "<td> ".$GHtml->formCheckBox("dropBox[]",
                                       ($iRow + 1),
                                       $Misc->stdProperties())." </td>\n".

          "<td> ".$GHtml->formInput("modelEnt[".$iRow."]",
                                     $_POST["modelEnt"][$iRow],
                                     $Misc->stdProperties())." </td>\n".

          "<td> ".$GHtml->formInput("qtyEnt[".$iRow."]",
                                    $_POST["qtyEnt"][$iRow],
                                    $Misc->stdNumStyle(5).
                                    $Misc->stdProperties())." </td>\n".

          "<td> <table border='1' class='dedeq'>

                ".$additional."

                </table>
                </td>\n".

          $GHtml->formHidden("rowId[".$iRow."]",
                             $_POST["rowId"][$iRow],
                             _NO_PROPERTY).

          "</tr>\n";
  }

  echo  "</table><br/>\n";

  echo  $GHtml->formInputButton( "Entry-data",
                                 "entry",
                                 "Entry-data",
                                 $stlButton).
        $GHtml->formInputButton( "Drop-row",
                                 "droprow",
                                 "Drop-row",
                                 $stlButton).
      	"</form>\n ".
      	"</body>\n";

  $Db->dc();
}else{

  $Misc->usrDie(_DB_CONN_ERROR);
}

/**
 * pending
 * <td> ".$GHtml->actionIcon("miniInput",
                                          "miniInput[".$iRow."]",
                                          15,
                                          15,
                                          "/ecs/images/modify.png",
                                          "Misc.miniInput(\"".$_SERVER["HTTP_HOST"]."\",
                                                          \"modelEnt[".$iRow."]\",
                                                          \"notaSrcEnt\",
                                                          \"rowId[".$iRow."]\");")." </td>

                <td> ".$GHtml->actionIcon("miniView",
                                          "miniView[".$iRow."]",
                                          15,
                                          15,
                                          "/ecs/images/view.png",
                                          "Misc.miniView(\"".$_SERVER["HTTP_HOST"]."\",
                                                         \"modelEnt[".$iRow."]\",
                                                         \"notaSrcEnt\",
                                                         \"rowId[".$iRow."]\");")." </td>
 */
?>